package service.imp;

import dao.DyhBasedbMapper;
import dao.DyhReportMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import po.DyhBasedb;
import po.DyhReport;
import po.DyhReportExample;
import service.reportService;

import java.util.List;

/**
 * Created by napianlin on 2017/3/31.
 */
@Service
public class resportServiceImpl implements reportService {

    @Autowired
    private DyhBasedbMapper dyhBasedbMapper;

    @Autowired
    private DyhReportMapper dyhReportMapper;

    @Override
    public List<DyhBasedb> getResportTopNByTypeId(int typeId, int topN) {

        List<DyhBasedb> list = dyhBasedbMapper.getResportTopNByTypeId(typeId, topN, true);
        return  list;
    }

    @Override
    public List<DyhReport> getReportsByRid(Integer rid) {
        DyhReportExample example=new DyhReportExample();
        DyhReportExample.Criteria criteria = example.createCriteria();
        criteria.andSeqidEqualTo(rid);
        List<DyhReport> list = dyhReportMapper.selectByExample(example);
        return list;
    }
}
